﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GmepCommonData.h"
#include <map>
#include "OwnerPtr.h"


namespace gmep
{
    class IGmepDisciplineInfo;
    class IGmepCategoryInfo;
    class IGmepCategoryInfoUtils;

    class GMEP_COMMONDATA_EXPORT IGmepCategoryInfoUtils
    {
    public:
        static gcmp::OwnerPtr<gmep::IGmepCategoryInfoUtils>  Create();

        virtual bool GetDisciplineInfoList(std::map<std::wstring, gcmp::OwnerPtr<gmep::IGmepDisciplineInfo>> &retDisciplineList, bool isBrief = false) = 0;

        /// \brief 根据GUID string 获得类别定义
        virtual bool GetCategoryInfo(std::wstring categoryGUID, gcmp::OwnerPtr<gmep::IGmepCategoryInfo>& retCategory) = 0;
        /// \brief 根据mapped name (sqlite表名)获取类别定义
        virtual bool GetCategoryInfoByMappedName(std::wstring mappedName, gcmp::OwnerPtr<gmep::IGmepCategoryInfo>& retCategory) = 0;

        /// \brief 根据标准码 获得类别定义
        virtual bool GetCategoryInfoByStandardCode(std::wstring standardCode, gcmp::OwnerPtr<gmep::IGmepCategoryInfo>& retCategory) = 0;

        /// \brief 根据类别的GUID string 获得类别的标准码
        virtual bool GetStandardCodeByCategoryGuid(std::wstring categoryGUID,std::wstring& standardCode) = 0;

        /// \brief 根据属性的GUID string 获得属性的标准码 （enumValue 设为负数）
        /// \brief 根据属性的GUID string 和enum int 值 获得属性枚举项的标准码 （enumValue 设为>=0）
        virtual bool GetStandardCodeByPropertyGuid(std::wstring propertyGUID, std::wstring& standardCode, int enumValue = -1) = 0;

        virtual bool GetGmepUnitInformation(std::map<std::wstring, short>& retUnitInfoMap) = 0;
    };
    class GMEP_COMMONDATA_EXPORT GmepCategoryInfoUtilsHandler
    {
    public:
        static GmepCategoryInfoUtilsHandler& Get();
        IGmepCategoryInfoUtils* GetUtils();
    private:
        GmepCategoryInfoUtilsHandler() {};

        gcmp::OwnerPtr<gmep::IGmepCategoryInfoUtils>    m_categoryInfoUtils;
    };
   
}